<?php

/**
 * This is the model class for table "{{search_log}}".
 *
 * The followings are the available columns in table '{{search_log}}':
 * @property integer $zsl_id
 * @property string $zsl_keyword
 * @property string $zsl_type
 * @property integer $zsl_num
 * @property string $zsl_ip
 * @property integer $inputtime
 * @property integer $updatetime
 * @property string $zm_id
 */
class SearchLog extends CActiveRecord
{
	/**
	 * Returns the static model of the specified AR class.
	 * @param string $className active record class name.
	 * @return SearchLog the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}

	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return '{{search_log}}';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		// NOTE: you should only define rules for those attributes that
		// will receive user inputs.
		return array(
			array('zsl_keyword, zsl_type, inputtime', 'required'),
			array('zsl_num, inputtime, updatetime', 'numerical', 'integerOnly'=>true),
			array('zsl_keyword', 'length', 'max'=>100),
			array('zsl_type', 'length', 'max'=>7),
			array('zsl_ip', 'length', 'max'=>18),
			array('zm_id', 'length', 'max'=>10),
			// The following rule is used by search().
			// Please remove those attributes that should not be searched.
			array('zsl_id, zsl_keyword, zsl_type, zsl_num, zsl_ip, inputtime, updatetime, zm_id', 'safe', 'on'=>'search'),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'zsl_id' => 'Zsl',
			'zsl_keyword' => 'Zsl Keyword',
			'zsl_type' => 'Zsl Type',
			'zsl_num' => 'Zsl Num',
			'zsl_ip' => 'Zsl Ip',
			'inputtime' => 'Inputtime',
			'updatetime' => 'Updatetime',
			'zm_id' => 'Zm',
		);
	}

	/**
	 * Retrieves a list of models based on the current search/filter conditions.
	 * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
	 */
	public function search()
	{
		// Warning: Please modify the following code to remove attributes that
		// should not be searched.

		$criteria=new CDbCriteria;

		$criteria->compare('zsl_id',$this->zsl_id);
		$criteria->compare('zsl_keyword',$this->zsl_keyword,true);
		$criteria->compare('zsl_type',$this->zsl_type,true);
		$criteria->compare('zsl_num',$this->zsl_num);
		$criteria->compare('zsl_ip',$this->zsl_ip,true);
		$criteria->compare('inputtime',$this->inputtime);
		$criteria->compare('updatetime',$this->updatetime);
		$criteria->compare('zm_id',$this->zm_id,true);

		return new CActiveDataProvider($this, array(
			'criteria'=>$criteria,
		));
	}
}